import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/AddBook.vue'
import Book from "../views/Book";
import Index from "../views/Index";
import BookUpdate from "../views/BookUpdate";
//1.引入2.下面配映射才能访问

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Index',
        component: Index,
        show: true,
        redirect: "/bookmanage",    //设置默认跳转
        children: [
            {
                path: '/addbook',
                name: '添加图书',
                component: () => import('../views/AddBook')
            },
            {
                path: '/about',
                name: 'About',
                component: () => import('../views/About')
            },
            {
                path: '/book',
                name: 'Book',
                component: () => import('../views/Book')
            }
            , {
                path: '/bookmanage',
                name: '查询图书',
                component: () => import('../views/BookManage')

            }]
    }, {
        path: '/update',
        component: BookUpdate,
        show:false
    }]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
